﻿namespace Leetcode.N0357;
public class Solution
{
    public int CountNumbersWithUniqueDigits(int n)
    {
        if (n == 0)
        {
            return 1;
        }
        if (n == 1)
        {
            return 10;
        }
        var sum = 10;
        var count = 9;
        var val = 9;
        while (n >= 2)
        {
            count = count * (val--);
            sum += count;
            n--;
        }

        return sum;
    }
}
